using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace DataHelper.BLL
{
    public class webpages_Roles
    {
        public int RoleId { get; set; }
        public string RoleName { get; set; }

        #region webpages_RolesSelectAll
        public static List<webpages_Roles> webpages_RolesSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_Roles.webpages_RolesSelectAll(strSearch,top,bottom,ConnectionString);
            List<webpages_Roles> webpages_RolesList = new List<webpages_Roles>();
            while(dr.Read())
            {
                webpages_Roles mywebpages_Roles = new webpages_Roles
                {
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0,
                    RoleName = !dr.IsDBNull(dr.GetOrdinal("RoleName")) ? (string)dr["RoleName"] : null
                };
                webpages_RolesList.Add(mywebpages_Roles);
        }
        dr.Close();
        dr.Dispose();
        return webpages_RolesList;
        }
        #endregion
        #region webpages_RolesSelectRow
        public static webpages_Roles webpages_RolesSelectRow(int RoleId, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_Roles.webpages_RolesSelectRow(RoleId, ConnectionString);
            webpages_Roles webpages_roles = null;

            if(dr.Read())
            {
                webpages_roles= new webpages_Roles
                {
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0,
                    RoleName = !dr.IsDBNull(dr.GetOrdinal("RoleName")) ? (string)dr["RoleName"] : null,

                };
            }
        dr.Close();
        dr.Dispose();
        return webpages_roles;
        }
        #endregion
        #region webpages_RolesInsertRow
        public static void webpages_RolesInsertRow(string RoleName, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_Roles.webpages_RolesInsertRow(RoleName, ConnectionString);
        }
        #endregion
        #region webpages_RolesUpdateRow
        public static void webpages_RolesUpdateRow(int RoleId, string RoleName, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_Roles.webpages_RolesUpdateRow(RoleId, RoleName, ConnectionString);
        }
        #endregion
        #region webpages_RolesDeleteRow
        public static void webpages_RolesDeleteRow(int RoleId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_Roles.webpages_RolesDeleteRow(RoleId,ConnectionString);
        }
        #endregion
    }
}
